import requests from "./requests"


export const reqLogin = (data) => {
    return requests({
        url: "/user/adminLogin",
        method: 'post',
        data: data
    })
}

export const reqUserInfo = (data) => {
    return requests({
        url: "/user/userInfo",
        method: 'get',
        params: data
    })
}

export const reqMenuList = () => {
    return requests({
        url: "/menu/getMenuList",
        method: 'get',
    })
}

export const reqParentMenu = () => {
    return requests({
        url: "/menu/getParentMenu",
        method: 'get',
    })
}

export const reqAddMenu = (data) => {
    return requests({
        url: "/menu/saveMenu",
        method: 'post',
        data: data
    })
}

export const reqSavePermission = (data) => {
    return requests({
        url: "/perms/savePermsInfo",
        method: 'post',
        data: data
    })
}

export const reqRolePerms = (data) => {
    return requests({
        url: "/role/getRolePermsList",
        method: 'get',
        params: data
    })
}

export const reqPermission = (data) => {
    return requests({
        url: "/perms/getPermsList",
        method: 'get',
        params: data
    })
}

export const reqSaveRolePerms = (data) => {
    return requests({
        url: `/role/updateRolePerms/${data.roleId}`,
        method: 'put',
        data: data.menuIds
    })
}

export const reqPermsCategory = () => {
    return requests({
        url: "/perms/getPermsCategory",
        method: 'get',
    })
}

export const reqRolePag = (data) => {
    return requests({
        url: "/role/getRolePage",
        method: 'get',
        params: data
    })
}

export const reqRoleMenu = (data) => {
    return requests({
        url: "/role/getRoleMenuList",
        method: 'get',
        params: data
    })
}

export const reqSaveRoleMenu = (data) => {
    return requests({
        url: `/role/updateRoleMenu/${data.roleId}`,
        method: 'put',
        data: data.MenuIds
    })
}

export const reqUserPage = (data) => {
    return requests({
        url: "/user/admin/getUserInfoPage",
        method: 'get',
        params: data
    })
}

export const reqUserMenu = (data) => {
    return requests({
        url: "/user/admin/getUserMenu",
        method: 'get',
        params: data
    })
}

export const reqUserRoleAndAll = (data) => {
    return requests({
        url: "/user/admin/getUserRoleAndAll",
        method: 'get',
        params: data
    })
}

export const reqSaveUserRole = (data) => {
    return requests({
        url: "/user/admin/saveUserRole",
        method: 'post',
        data: data
    })
}
